package com.liuyk.util;

import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.widget.ImageView;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * 图片加载
 *
 * Created by Administrator on 2015/9/13.
 */
public class ImageLoadUtil {

    public static void saveToSDCard(ImageView imageView, String savePath, String saveName){
        BitmapDrawable bd = (BitmapDrawable) imageView.getDrawable();
        File f = new File(savePath, saveName);
        try {
            FileOutputStream out = new FileOutputStream(f);
            bd.getBitmap().compress(Bitmap.CompressFormat.PNG, 100, out);//30表示压缩70% 100表示不压缩
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

}
